/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JOrderLinePanel.java
 *
 * Created on 2010-5-31, 8:31:04
 */

package cn.ekuma.epos.analysis.businesspartner.link;

import cn.ekuma.epos.datalogic.I_DataLogicSystem;
import cn.ekuma.epos.order.JOrderLines;
import cn.ekuma.epos.qkorder.event.OrderChangedEvent;
import cn.ekuma.epos.qkorder.event.OrderChangedListener;
import com.openbravo.bean.erp.OrderLine;
import com.openbravo.pos.base.AppView;

import java.awt.BorderLayout;

/**
 *
 * @author Administrator
 */
public class JOrderLinePanel extends javax.swing.JPanel implements OrderChangedListener{
    JOrderLines m_Orderlines;
    /** Creates new form JOrderLinePanel */
    public JOrderLinePanel(AppView app,I_DataLogicSystem dlSystem) {
        initComponents();
        m_Orderlines=new JOrderLines(dlSystem.getResourceAsXML("Order.Line"));
        this.add(m_Orderlines, BorderLayout.CENTER);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setLayout(new java.awt.BorderLayout());
    }// </editor-fold>//GEN-END:initComponents

    public void orderChanged(OrderChangedEvent event) {
            m_Orderlines.clearOrderLines();
            for (OrderLine l : event.getOrder().getLines()) {
               m_Orderlines.addOrderLine(l);
            }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
